package cn.mistorange.mapper;


import cn.mistorange.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    // 获取所有分类
    List<Category> getAllCategories(String type);

    @Insert("insert into db_mistorange.categories (name,type)value(#{name},#{type})")
    void addCategory(String name, String type);

    //删除
    @Delete("delete from db_mistorange.categories where db_mistorange.categories.id = #{id}")
    void deleteCategory(Integer id);

    void updateCategory(Integer id, String name, String type);

    @Select("select * from categories where id = #{id}")
    Category getByIdCategories(Integer id);
}